<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	template="/template/commonLoginAction.xhtml">

	<ui:define name="title">
		<h:outputText value="#{Title.login_page}" />
	</ui:define>

	<ui:define name="header">
		<h:outputText value="ENTER YOUR USERNAME AND PASSWORD" />
	</ui:define>

	<ui:define name="content">
		<h:form id="loginForm">
			<p:fieldset styleClass="fieldset" legend="Authentication Form">
				<p:messages id="messages" />

				<h:panelGrid id="loginPanelGrid"
					style="margin: 0 auto; margin-top: 25px; text-align: right"
					cellspacing="8" columns="3">
					<h:panelGroup>
						<h:outputText styleClass="outputText" value="User Name:" />
						<h:outputText style="color:red" value=" * " />
					</h:panelGroup>
					<p:inputText id="userName"
						value="#{userLoginBean.user.user_number}" required="true"
						label="User Name" title="Enter Your User Name!"
						requiredMessage="Username: Value is required."
						style="font-weight:bold" />
					<p:watermark for="userName" value="Enter Your User Name!" />

					<h:panelGroup>
						<h:outputText styleClass="outputText" value="Password:" />
						<h:outputText style="color:red" value=" * " />
					</h:panelGroup>
					<p:password id="password" value="#{userLoginBean.user.password}"
						required="true" label="Password" title="Enter Your Password!"
						requiredMessage="Password: Value is required."
						style="font-weight:bold" />
					<p:watermark for="password" value="Enter Your Password!" />

					<h:panelGroup>
						<h:outputLabel styleClass="outputText" for="remembered"
							value="Remember Me" />&nbsp;&nbsp;
						<p:selectBooleanCheckbox id="remembered" />
					</h:panelGroup>
					<h:panelGroup style="display:block; text-align: left;">
						<p:commandButton id="submitButton" value="#{Button.sign_in}"
							action="#{userLoginBean.Login}" update=":loginForm:messages"
							styleClass="cta-button">
						</p:commandButton>
					</h:panelGroup>
					<h:outputLabel value="" />

				</h:panelGrid>
				<h:panelGroup style="display:block; text-align: right;">
					<a href="/WebJsfSpringHib/flows/forgotp/recoverypass.jsf"
						style="color: blue; font-size: 14px;">Forgot your pass?</a>
				</h:panelGroup>
			</p:fieldset>
		</h:form>
	</ui:define>

	<ui:define name="footer">
		<h:form>
			<h:outputText value="Copyright ©Suat Demir" />
		</h:form>
	</ui:define>

	<script type="text/javascript">
	
        function handlePasswordRequest(xhr, status, args) {
            	window.location = "/WebMvnSprHibPrm/jsf/recoverypassword.jsf";
           }
	        function handleLoginRequest(xhr, status, args) {
	        	window.location = "/WebMvnSprHibPrm/jsf/home/home.jsf";
	       }
    </script>

</ui:composition>
